import React, { Component } from 'react'
// import qs from 'query-string'

const DetailData = [
  { id: '01', content: '你好，中国' },
  { id: '02', content: '你好，实施计划' },
  { id: '03', content: '你好，啊啊啊啊' },
]

export default class Detail extends Component {
  render() {
    // 接收params参数
    const {id,title} = this.props.match.params;

    // 接收search参数
    // const {id,title} = qs.parse(this.props.location.search);

    // 接收state参数
    // const { id, title } = this.props.location.state || {};
    const findResult = (DetailData.find((detailObj) => {
      return detailObj.id === id;
    }) || {}).content;
    return (
      <div>
        <ul>
          <li>ID:{id}</li>
          <li>TITLE:{title}</li>
          <li>CONTENT:{findResult}</li>
        </ul>
      </div>
    )
  }
}
